package main

import (
	"fmt"
	"time"
)

func Count(ch chan int) {
	ch <- 1 //像管道中写入数据，写入后阻塞到当前位置，当通道内当数据被读取，才继续往下执行。
	fmt.Println("Counting")
}
func main() {
	chs := make([]chan int, 10)
	for i := 0; i < 10; i++ {
		chs[i] = make(chan int)
		go Count(chs[i])
	}

	for _, ch := range chs {
		time.Sleep(time.Duration(2) * time.Second)
		fmt.Println(<-ch)
	}
}
